'use strict';
(function() {
	var visit = (function($) {
		var
		chooseForm = {
			init : function() {
				this.choose();
			},
			choose : function() {
				var _this = this;

				$('#visit').click(function() {
					layer.open({
						type: 1,
					  title: '请选择样本去向：',
					  skin: 'layui-layer-rim', //加上边框
					  area: ['420px', '240px'], //宽高
					  content: '<div class="sample-list">' + 
					  					'<a class="btn btn-success" href="/clinical/create-visit?visit=1">药物随访</a>' + 
					  					'<a class="btn btn-success" href="/clinical/create-visit?visit=2">手术随访</a></div>',
					});

					return false;
				});

			},
		},
		common = {
			submitButton : $('#submitButton'),
			form : $('#visitForm'),
			status : $("#status").val(),
			init : function() {
				helper.date_ymd(true);
				this.submit();
			},
			submit : function() {
				var _this = this, msg;

				this.submitButton.click(function(e) {
					if (_this.fieldTest()) {
						return true;
					} else {
						return false;
					}
				});
			},
			fieldTest : function() {
				var inputs = $("input[type='text']");

				return helper.detect(inputs);
			},
		},
		init = function() {
			common.init();
			chooseForm.init();
		};
		return {
			init : init
		};
	})(jQuery);

	visit.init();
})();